//
//  ICChatMessageVerifyCell.m
//  onlineCustoSDK
//
//  Created by 曹宗华 on 2017/12/4.
//  Copyright © 2017年 com.netinfosz. All rights reserved.
//

#import "ICChatMessageVerifyCell.h"
#import "ICMediaManager.h"
#import "ICMessageModel.h"
#import "ICMessage.h"
#import "ICFileTool.h"
#import "ICMessageHelper.h"

@interface  ICChatMessageVerifyCell()
@property(nonatomic,strong)UIImageView *bigImageview;
@property(nonatomic,strong)UIImageView  *smallImageview;
@property(nonatomic,strong)UILabel *titleLab;
@property(nonatomic,strong)UILabel  *tipLab;
@property(nonatomic,strong)UILabel  *label3;
@property(nonatomic,strong)UIView  *upView;
@property(nonatomic,strong)UIButton *topBtn;
@end
@implementation ICChatMessageVerifyCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.bubbleView.userInteractionEnabled=YES;
        [self.bubbleView addSubview:self.upView];
        [self.upView addSubview:self.bigImageview];
        [self.upView addSubview:self.tipLab];
        [self.upView addSubview:self.titleLab];
        [self.bubbleView addSubview:self.label3];
        [self.bubbleView bringSubviewToFront:self.label3];
        [self.bubbleView bringSubviewToFront:self.smallImageview];
        [self.bubbleView addSubview:self.smallImageview];
        [self.bubbleView addSubview:self.topBtn];
        [self.bubbleView bringSubviewToFront:self.topBtn];
        self.bigImageview.userInteractionEnabled=YES;
        self.smallImageview.userInteractionEnabled=YES;
//        UITapGestureRecognizer  *tapRecognizer=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(tap:)];
//        [self.contentView addGestureRecognizer:tapRecognizer];
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)setModelFrame:(ICMessageFrame *)modelFrame
{
    [super setModelFrame:modelFrame];
//    self.bubbleView.frame=CGRectMake(0, 0, 100, 50);
    self.titleLab.text= self.modelFrame.model.message.content;
      _tipLab.text=@"点击进行操作";
    CGRect bubbleframe=self.bubbleView.frame;
    self.upView.frame=CGRectMake(6, 0, bubbleframe.size.width-6, bubbleframe.size.height*0.7);
    self.bigImageview.frame=CGRectMake(20, 10, 30, 40);
    self.titleLab.frame=CGRectMake(self.bigImageview.frame.origin.x+5+self.bigImageview.frame.size.width,10, 190, 20);
    self.tipLab.frame=CGRectMake(self.titleLab.frame.origin.x, self.titleLab.frame.origin.y+self.titleLab.frame.size.height+5, self.titleLab.frame.size.width, self.titleLab.frame.size.height);
    self.label3.frame=CGRectMake(20, bubbleframe.size.height*0.7+5, 100,20);
    self.smallImageview.frame=CGRectMake(bubbleframe.size.width-35, bubbleframe.size.height*0.7+5, 20, 20);
    self.topBtn.frame=CGRectMake(0, 0, bubbleframe.size.width, bubbleframe.size.height);
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (UIButton*)topBtn
{
    if (!_topBtn) {
        _topBtn=[[UIButton alloc] init];
//        _topBtn.backgroundColor=[UIColor yellowColor];
        [_topBtn addTarget:self action:@selector(clicked:) forControlEvents:UIControlEventTouchUpInside];
        
    }
    return _topBtn;
}
- (UIImageView*)bigImageview
{
    if(!_bigImageview)
    {
        _bigImageview=[[UIImageView alloc] init];
        _bigImageview.backgroundColor=[UIColor clearColor];
        _bigImageview.image=[UIImage imageNamed:@"business.png"];
        
    }
    return _bigImageview;
}
- (UIImageView*)smallImageview
{
    if (!_smallImageview)
    {
        _smallImageview=[[UIImageView alloc] init];
        _smallImageview.image=[UIImage imageNamed:@"verify.png"];
        _smallImageview.backgroundColor=[UIColor clearColor];
    }
    return _smallImageview;
}
- (UIView*)upView
{
    if (!_upView) {
        _upView=[[UIView alloc] init];
        _upView.backgroundColor=XZColor(50, 164,238);
        _upView.layer.masksToBounds=YES;
        _upView.layer.cornerRadius=2.5;
        
    }
    return _upView;
}
-(UILabel*)titleLab
{
    if (!_titleLab) {
        _titleLab=[[UILabel alloc] init];
        _titleLab.textColor=[UIColor whiteColor];
        _titleLab.font=[UIFont systemFontOfSize:10];
        _titleLab.textAlignment=NSTextAlignmentLeft;
//        _titleLab.text=@"普通资金帐号认证";
    }
    return _titleLab;
}
- (UILabel*)tipLab
{
    if(!_tipLab)
    {
        _tipLab=[[UILabel alloc] init];
        _tipLab.textAlignment=NSTextAlignmentLeft;
        _titleLab.font=[UIFont systemFontOfSize:10];
        _titleLab.textColor=[UIColor whiteColor];
       
    }
    return _tipLab;
}
- (UILabel*)label3
{
    if(!_label3)
    {
        _label3=[[UILabel alloc] init];
        _label3.textColor=[UIColor whiteColor];
        _label3.textAlignment=NSTextAlignmentCenter;
        _label3.text=@"业务办理";
        _label3.textColor=[UIColor grayColor];
//        _label3.backgroundColor=[UIColor yellowColor];
    }
    return _label3;
}
- (void)clicked:(UIButton*)btn
{
    NSLog(@"点击了按钮");
    if ([self.verifydelegate respondsToSelector:@selector(popVerifvc)])
    {
        [self.verifydelegate  popVerifvc];
         NSLog(@"执行了代理");
    }
}
- (void)tap:(UITapGestureRecognizer*)gesture
{
    NSLog(@"手势点击了");
//    if (self.verifydelegate&&[self.verifydelegate respondsToSelector:@selector(tapPopVC)])
//    {
//        [self.verifydelegate  tapPopVC];
//    }
}
@end
